package ngram.util;

import javax.swing.JComboBox;
import javax.swing.JComponent;

/**
 *
 * @author g1wshimu
 */
public class GuiUtil {

    private GuiUtil() {
    }

    /**
     * Set the enabled property of all the given components to the given 
     * boolean.
     * @param enable
     * @param components 
     */
    public static void setEnabled(boolean enable, JComponent... components) {
        for (JComponent component : components) {
            component.setEnabled(enable);
        }
    }
    
    /**
     * Add all the members of the given Enum type to the given JComboBox.
     * 
     * @param type
     * @param dropDown 
     */
    public static void addEnumAsOptions(Class<? extends Enum> type, JComboBox dropDown) {
        for (Enum e : type.getEnumConstants()) {
            dropDown.addItem(e);
        }
    }
    
    
}
